package top.blackr.folivora.common.core.exception;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import top.blackr.folivora.common.core.enums.ResultEnum;

import java.io.Serial;

/**
 * 业务异常信息，推荐使用BizException(ResultEnum resultEnum)
 */
@JsonSerialize(using = BizExceptionSerializer.class)
public class BizException extends RuntimeException{

    @Serial
    private static final long serialVersionUID = 3456716270805901718L;

    public BizException(ResultEnum resultEnum) {
        super(resultEnum.getCnMes());
    }

    public BizException(String okMsg) {
        super(okMsg);
    }

    public BizException(ResultEnum resultEnum, Throwable t) {
        super(resultEnum.getCnMes(), t);
    }

}
